# @Timer:2022/4/1
# @作者:meng
# @文件名:Allure_demo.py

import allure,pytest
# 方式三:参数为列表中嵌套字典

# datas_dict = [
#     {"a": 1, "b": 2, "c": 3},
#     {"a": 11, "b": 22, "c": 33},
#     {"a": 111, "b": 222, "c": 333},
# ]
# @pytest.mark.parametrize("data", datas_dict)
# @allure.title("第一个用例")
# def test_add03(data):
#     res = data["a"] + data["b"]
#     assert res == data["c"]

@allure.feature("搜索模块")
class TestDemo1:
    @allure.story("搜索成功")
    @allure.title("搜索成功第一条用例")
    def test_01(self):
        print("打开搜索页面")

    @allure.story("搜索失败")
    def test_02(self):
        pass

@allure.feature("登录模块")
class TestDemo2:
    @allure.story("登录成功")
    def test_01(self):
        with allure.step("步骤1：打开应用"):
            print("打开应用")
        with allure.step("步骤2：输入用户信息"):
            allure.attach("这是文本信息",name="文本展示")
            print("输入用户信息")

        with allure.step("步骤3：进入登录页面"):
            # assert 1 == 2
            allure.attach.file(r'C:\Users\ym\Pictures\IMG_20210610_152315.bmp',name='图片展示',attachment_type=allure.attachment_type.BMP)
            print("进入登录页面")

    @allure.story("登录失败")
    def test_02(self):
        pass